class Solution {
public:
    vector<int> corpFlightBookings(vector<vector<int>>& bookings, int n) {
        vector<int> sum(n + 2, 0);
        for (int i = 0; i < bookings.size(); i++)
        {
            sum[bookings[i][0]] += bookings[i][2];
            sum[bookings[i][1] + 1] -= bookings[i][2];
        }

        vector<int> ans;
        for (int i = 1; i <= n; i++)
        {
            sum[i] += sum[i - 1];
            ans.push_back(sum[i]);
        }

        return ans;
    }
};